# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor : bartus <arch-user-repoᘓbartus.33mail.com>
pkgname=popsift
pkgver=1.0.0.git2
_commit=c0dc3d8
pkgrel=1
pkgdesc="Realtime GPU implementation of SIFT"
arch=('loong64' 'x86_64')
url="https://github.com/alicevision/popsift"
license=('MPL2')
depends=('boost-libs')
makedepends=('boost' 'cmake' 'ninja' 'git' 'cuda')
options=('staticlibs' '!lto')
source=("git+https://github.com/alicevision/popsift.git#commit=$_commit")
sha256sums=('SKIP')

build() {
  cd popsift
  cuda_archs="52;53;60;61;62;70;72;75;80;86;87;89;90"

  cmake \
    -Bbuild_static \
    -GNinja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=OFF \
    -DCUDA_USE_STATIC_CUDA_RUNTIME=ON \
    -DPopSift_CUDA_CC_LIST="$cuda_archs"
  ninja -C build_static

  cmake \
    -Bbuild_shared \
    -GNinja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -DPopSift_CUDA_CC_LIST="$cuda_archs"
  ninja -C build_shared
}

package() {
  cd popsift
  DESTDIR="${pkgdir}" ninja -C build_static install
  DESTDIR="${pkgdir}" ninja -C build_shared install
}

# vim:set ts=2 sw=2 et:
